package com.mall.auth;

import com.mall.entity.sys.UserEO;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;



@Data
public class UserDetailEO implements UserDetails {
   private static final long serialVersionUID = -5057486648631246309L;
   private UserEO user;
   
   private Collection<? extends GrantedAuthority> authorities;
   
   @Override
   public String getPassword() {
      return getUser().getPassword();
   }
   @Override
   public String getUsername() {
      return getUser().getUsername();
   }
   @Override
   public boolean isAccountNonExpired() {
      return true;
   }
   @Override
   public boolean isAccountNonLocked() {
      return true;
   }
   @Override
   public boolean isCredentialsNonExpired() {
      return true;
   }
   @Override
   public boolean isEnabled() {
      return true;
   }
   public UserDetailEO(UserEO user) {
      super();
      this.user = user;
   }
}
